package com.hdaccp.shop.service.impl;

import com.hdaccp.pojo.po.Shop;
import com.hdaccp.shop.service.ShopService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.List;

@Service
public class ShopServiceImpl implements ShopService {
    @Autowired
    private EntityManager entityManager;
    
    @Override
    public List<Shop> queryPage(int currentPage, int pageSize) {
       String jpql ="select n from Shop n";
       Query query=entityManager.createQuery(jpql);
       query.setFirstResult((currentPage-1)*pageSize);
       query.setMaxResults(pageSize);
        return query.getResultList();
    }
}
